package com.color.admin.common.core.exception;


import com.color.admin.common.core.result.ResultCode;

/**
 * @author HaiQiu
 * @date 2021/11/19
 * 基本异常处理
 */
public class BaseException extends RuntimeException{

    public int code;

    public String msg;

    public BaseException(int code,String msg){
        super(msg);
        this.code = code;
    }

    public BaseException(ResultCode resultCode){
        super(resultCode.getMsg());
        this.code = resultCode.getCode();
    }

    public BaseException(String msg){
        super(msg);
        this.code = ResultCode.FAIL.getCode();
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }
}
